<template>
<p>在 <code>formatter</code>的情况下显示值，我们通常同时使用 <code>parser</code></p>
  <el-input
    v-model="input"
    style="width: 240px"
    placeholder="Please input"
    :formatter="(value) => `$ ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')"
    :parser="(value) => value.replace(/\$\s?|(,*)/g, '')"
  />
</template>

<script lang="ts" setup>
import { ref } from 'vue'
const input = ref('')
</script>

<style scoped>
@import '../../assets/elementPlusDemo.css'
</style>